<!-- /* Description for file.
 * 顾问统计
 *
 * @copyright     Copyright 2008-2010, PHInfo Services Inc. (http://www.phinfoservices.com)
 * @package       ues
 * @subpackage    ues/app/views/logresumesearches
 * @since         ues
 * @version       V0.0.1
 * @modifiedby    张朋2011年0707
 * @lastmodified  张朋2011年0707
 */-->
<?php
echo $html->css('flexigrid');
echo $html->css('start/jquery-ui-1.8.2.custom');
echo $html->css ( 'style' );
echo $javascript->link('jquery-1.4.2');
echo $javascript->link('flexigrid/flexigrid');
echo $javascript->link('allinfocanditate');
echo $javascript->link('organ');

//下面是datepicker需要引入的js文件
echo $javascript->link('ui/jquery.ui.core.js');
echo $javascript->link('ui/jquery.ui.widget.js');
echo $javascript->link('ui/jquery.ui.datepicker.js');
echo $javascript->link('ui/i18n/jquery.ui.datepicker-zh-CN.js');//中文语言包
?>

<script language="javascript">
var delurl="<?php echo $deleteurl; ?>";
var editurl="<?php echo $editurl; ?>";
var addurl="<?php echo $addurl; ?>";
var data=<?php echo $data; ?>;
var disbutton=<?php echo $javascript->object($disbutton);?>;
var title2="<?php echo $title2; ?>";
</script>
<script language="javascript">
function button(com,grid,url)
{
	var ids=$("#flex").getCheckedRows();
	if(com=="delete")
	{
		var pids="";
		if(ids.length==0)
		{
			alert("请选择你要删除的项");
			return;
		}
		if(!confirm("确定删除?"))
		{
			return;
		}
		for(i=0;i<ids.length;i++)
		{
			pids=pids+ids[i]+"/";
		}

		$.ajax({
			type: "post",
			url: url,
			data: {id:pids},
			dataType:"json",
			success: function(data) {
				$(".clearckeck").trigger("click");
				$(".pReload").trigger("click");
				$(".notice").html(data.message);
			},
			error: function(data) {
				$(".clearckeck").trigger("click");
				$(".pReload").trigger("click");
				$(".notice").html('data.message');
			}
		});
	}
	else if(com=="add")
	{
		window.open(url,'mainFrame2');
	}
	else if(com=="edit")
	{
		if(ids.length!=1)
		{
			alert("请选择一个选项");
		}
		else
		{
			var seid=ids[0];
			var eurl=url+"?id="+seid;
			window.open(eurl,'mainFrame2');
		}
	}
	else
	{
		var pix=com.substring(0,2);
		switch (pix)
		{
			case "aj":
			var pids="";
			if(ids.length==0&&com.substring(0,3)!="ajj")
			{
				alert("请选择选项");
				return;
			}
			for(i=0;i<ids.length;i++)
			{
				pids=pids+ids[i]+"/";
			}
			$.ajax({
				type: "post",
				url: url,
				data: {id:pids},
				dataType:"json",
				success: function(data) {
					$(".pReload").trigger("click");
					$(".notice").html(data.message);
				},
				error: function(data) {
					$(".clearckeck").trigger("click");
					$(".pReload").trigger("click");
					$(".notice").html('data.message');
				}
			});
			break;
			case "up":
			if(ids.length!=1)
			{
				alert("请选择一个选项");
			}
			else
			{
				var seid=ids[0];
				var eurl=url+"?id="+seid;
				window.open(eurl,'mainFrame2');
			}
			break;
			default:
			window.open(url,'mainFrame2');
		}
	}
}
</script>
<script type="text/javascript">
var b='';
</script>
<script type="text/javascript">
var ob=<?php echo $ob;?>;
if(ob.length==0)
{

}
else
{
	for(i=0;i<ob.length;i++)
	{
		var l=b.length;
		b[l]=ob[i];
	}
}
</script>
<script type="text/javascript">
var now = new Date();                    //当前日期
var nowDayOfWeek = now.getDay();         //今天本周的第几天
var nowDay = now.getDate();              //当前日
var nowMonth = now.getMonth();           //当前月
var nowYear = now.getYear();             //当前年
nowYear += (nowYear < 2000) ? 1900 : 0;  //
$(function(){
	$.datepicker.setDefaults($.datepicker.regional['']);
	//		$('.datepickerSpan :input').datepicker($.datepicker.regional['zh-CN']);
	$(".datepickerSpan :input").datepicker({inline: true});
	$('.datepickerSpan :input').datepicker('option', {dateFormat: "yy-mm-dd"});
	$('.datepickerSpan :input').datepicker( "option", "closeText", 'X' );

	$('#nowweek').click(function(){
		var weekStartDate = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek);
		$('#dateStart1').val(formatDate(weekStartDate));
		var weekEndDate = new Date(nowYear, nowMonth, nowDay + (6 - nowDayOfWeek));
		$('#dateEnd1').val(formatDate(weekEndDate));
		$(".searchform").submit();
	});
	$('#nowmonth').click(function(){
		var monthStartDate = new Date(nowYear, nowMonth, 1);
		$('#dateStart1').val(formatDate(monthStartDate));
		var monthEndDate = new Date(nowYear, nowMonth, getMonthDays(nowMonth));
		$('#dateEnd1').val(formatDate(monthEndDate));
		$(".searchform").submit();
	});
});
//格式化日期：yyyy-MM-dd
function formatDate(date) {
	var myyear = date.getFullYear();
	var mymonth = date.getMonth()+1;
	var myweekday = date.getDate();

	if(mymonth < 10){
		mymonth = "0" + mymonth;
	}
	if(myweekday < 10){
		myweekday = "0" + myweekday;
	}
	return (myyear+"-"+mymonth + "-" + myweekday);
}
//获得某月的天数
function getMonthDays(myMonth){
	var monthStartDate = new Date(nowYear, myMonth, 1);
	var monthEndDate = new Date(nowYear, myMonth + 1, 1);
	var   days   =   (monthEndDate   -   monthStartDate)/(1000   *   60   *   60   *   24);
	return   days;
}

$(function(){
$("#cand_search").click(function(){
	$.get('<?php echo ROOT_WEB_PATH; ?>/candidates/candcount',{m:Math.random()},function(d){
		var d_ary = d.split(',');
		$('#SumUser').html(d_ary[0]);
		$('#SumLogin').html(d_ary[1]);
		$('#SumAddResume').html(d_ary[2]);
		$('#SumSearchResume').html(d_ary[3]);
		$('#SumReadResume').html(d_ary[4]);
		$('#SumCommendResume').html(d_ary[5]);
		$('#SumSendResume').html(d_ary[6]);
		$('#SumClient').html(d_ary[7]);
		$('#SumInterview').html(d_ary[8]);
		$('#SumExpense').html(d_ary[9]);
		$('#SumOrderNum').html(d_ary[10]);
		$('#SumFinishOrder').html(d_ary[11]);
		$('#SumRelation').html(d_ary[12]);
		$('#SumVisitor').html(d_ary[13]);
		$('#SumVisitation').html(d_ary[14]);
	});
	$("#cand_count").show();
});

$("#outexcel").click(function () {
	button('op','','<?php echo ROOT_WEB_PATH;?>/outputexcels/candidates');
});
});
</script>

<!-- 当前位置-->
<div id="tabmenubar">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabmenubartitle1"><?php echo  __('YourPosition');//您现在的位置：?></td>
		<td class="tabmenubartitle2"><?php echo __('Usersmanagements');//一级目录
										   echo '>';?>
									<?php echo $html->tag('span', __('Statistics Search',true));//当前操作地用span加粗?> 						  
		</td>
	</tr>
</table>
</div>
<!-- 当前位置-->

<!-- 查询区域-->
<div class="tabflex" style="width:1000px;">
<fieldset><legend>统计查询<?php //echo __('Statistics Search')?></legend>
<?php if (count($searchitems)>0)
{
	$j=0;
	echo "<form class='searchform'>";
	for ($i=0;$i<count($searchitems);$i++)
	{
		$item=$searchitems[$i];

		if ($item['type']=="text")
		{
			echo $item['lable']."<input type='text' name='".$item['name']."' class='sitems' id=".$item['id']."/>";
		}
		elseif ($item['type']=="select")
		{
			echo $item['lable']."<select name='".$item['name']."' class='sitems' id=".$item['id'].">";
			foreach ($item['op'] as $k=>$v)
			{
				echo "<option value='$v'>$k</option>";
			}
			echo "</select>";
		}
		elseif ($item['type']=="checkbox")
		{
			echo "<input type='checkbox' name='".$item['name']."' class='sitems' id=".$item['id']. "value=".$item['value']." ></input>".$item['lable'];
		}
		elseif ($item['type']=="date")
		{
			echo $item['lable'];?><span class="datepickerSpan"><input type='text' name="<?php echo $item['name']?>" class='sitems' id="<?php echo $item['id'];?>"/></span>
		<?php 
		}
		if ($item['br'])
		{
			echo "<br>";
		}
	}
}
echo "<br><input type='submit' class='btn2' value='查询'/>";
echo "<input type='reset' class='btn2' value='重置'/>";
echo "<input type='button' class='btn2' value='本周' id='nowweek' />";
echo "<input type='button' class='btn2' value='本月' id='nowmonth' />";
echo "<input type='button' class='btn2' value='导出' id='outexcel' />";
echo "</form>";
?>
</fieldset>
</div>
<!-- 查询区域-->

<!-- 表格-->
<div class="tabflex">
	<table id="flex" style="display: none"></table><br></br>
<table bgcolor="#CCCCCC" border="0" cellpadding="1" cellspacing="1" width="100%">
<tr bgcolor="#FFFFFF">
<td colspan="15" align="left">总计：<input id="cand_search" type="button" value="查看总计" /></td>
</tr>
<tr bgcolor="#DDDD77">
<TD width="80px">顾问</TD><TD width="55px">登录次数</TD><TD width="55px">添加简历</TD><TD width="65px">查简历次数</TD>
<TD width="55px">查看简历</TD><TD width="55px">推荐简历</TD><TD width="55px">发送简历</TD><TD width="55px">添加客户</TD>
<TD width="55px">面试人次</TD><TD width="55px">收费(元)</TD><TD width="55px">负责项目</TD><TD width="65px">已完成项目</TD>
<TD width="55px">联系记录</TD><TD width="65px">添加寻访人</TD><TD width="65px">寻访印象</TD>
</tr>
<tr bgcolor="#FFFFFF" id="cand_count" style="display:none;">
		<TD><span id="SumUser" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumLogin" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumAddResume" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumSearchResume" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumReadResume" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumCommendResume" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumSendResume" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumClient" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumInterview" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumExpense" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumOrderNum" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumFinishOrder" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumRelation" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumVisitor" style="word-break:break-all;">0</span></TD>
		<TD><span id="SumVisitation" style="word-break:break-all;">0</span></TD>

</tr>
</table>
</div>
<br>
<!-- 表格-->


